package es.manuel.maa.applet;

import javax.swing.JPanel;

public class JPanelAppletListener extends JPanel implements AppletListener {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -1157412130027808850L;

	public final void init(AppletEvent event) {
		event.getApplet().getContentPane().add(this);
		this.internalInit(event.getApplet());
	}

	public final void start(AppletEvent event) {
		event.getApplet().setVisible(true);
		this.internalStart(event.getApplet());
	}

	public final void stop(AppletEvent event) {
		event.getApplet().setVisible(false);
		this.internalStop(event.getApplet());
	}

	public final void destroy(AppletEvent event) {
		event.getApplet().getContentPane().remove(this);
		this.internalDestroy(event.getApplet());
	}

	protected void internalInit(ConfigurableApplet applet) {

	}

	protected void internalStart(ConfigurableApplet applet) {

	}

	protected void internalStop(ConfigurableApplet applet) {

	}

	protected void internalDestroy(ConfigurableApplet applet) {
	}

}
